package org.jash.sportnews2109.net

import android.graphics.Bitmap
import androidx.lifecycle.LiveData
import io.reactivex.rxjava3.core.Observable
import okhttp3.ResponseBody
import org.jash.sportnews2109.entity.Category
import org.jash.sportnews2109.entity.Comment
import org.jash.sportnews2109.entity.News
import org.jash.sportnews2109.entity.Page
import org.jash.sportnews2109.entity.Res
import org.jash.sportnews2109.entity.User
import org.jash.sportnews2109.entity.Video
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query
import retrofit2.http.Url

interface APIService {
    @GET("/api/nt/all")
    fun getCategories():Observable<Res<List<Category>>>
    @GET("/api/news/tophot")
    fun getHots():Observable<Res<List<News>>>
    @GET("/api/news/page")
    fun getNewsByCategoryId(@Query("type") type:Int,@Query("page") page:Int,@Query("size") size:Int):Observable<Res<Page<News>>>
    @POST("/api/user/loginname")
    fun login(@Body user:Map<String, String>):Observable<Res<String>>
    @GET("/api/user/loginout")
    fun logout():Observable<Res<Any?>>
    @GET("/api/sms/sendlcode")
    fun sendLoginCode(@Query("phone") phone:String):Observable<Res<String>>
    @POST("/api/user/logincode")
    fun loginByPhoneCode(@Body map: Map<String, String>):Observable<Res<String>>
    @GET("/api/sms/sendrcode")
    fun sendRegisterCode(@Query("phone") phone:String):Observable<Res<String>>
    @POST("/api/sms/checkrcode")
    fun checkRegisterCode(@Body user: Map<String, String>):Observable<Res<Any?>>
    @POST("/api/user/register")
    fun register(@Body user: Map<String, String>):Observable<Res<Any?>>
    @GET("/api/news/detail")
    fun getDetail(@Query("id") id:Int):Observable<Res<News>>
    @GET("/api/newsCollect/collect")
    fun collect(@Query("nid") id:Int):Observable<Res<String>>
    @GET("/api/newsCollect/my")
    fun getMyCollect():Observable<Res<List<News>>>
    @GET("/api/newsComment/comments")
    fun getCommentsByNewsId(@Query("nid") id:Int):Observable<Res<List<Comment>>>
    @GET("/api/user/all")
    fun getUsers1():Observable<Res<List<User>>>
    @GET("/api/ud/all.do")
    fun getUsers2():Observable<Res<List<User>>>
    @POST("/api/newsComment/save")
    fun sendComment(@Body comment: Comment):Observable<Res<Any?>>
    @GET("/api/video/page?order=id")
    fun getVideoPage(@Query("page") page:Int,@Query("size") size:Int):Observable<Res<Page<Video>>>

}